]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
extensionSystem: Make the init function optional
authorJasper St. Pierre <jstpierre@mecheye.net>
Mon, 4 Jun 2012 22:43:52 +0000 (18:43 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Tue, 12 Jun 2012 21:16:09 +0000 (17:16 -0400)
A large amount of extensions have something like this in them:

    function init() {}

Since we have encouraged extension authors to try and not make any
changes in init, it feels weird and strange to have to create an
initialization function that does nothing. From now on, don't require
it.

https://bugzilla.gnome.org/show_bug.cgi?id=677586

js/ui/extensionSystem.js

index cb205a7f2ea686322e9546b17dfd922f14fe9c88..35b02a4829fd8ccff7c3b55bae32312719ff9d1e 100644 (file)
@@ -190,16 +190,13 @@ function initExtension(uuid) {
         return;
     }
 
-    if (!extensionModule.init) {
-        logExtensionError(uuid, 'missing \'init\' function');
-        return;
-    }
-
-    try {
-        extensionState = extensionModule.init(extension);
-    } catch (e) {
-        logExtensionError(uuid, 'Failed to evaluate init function:' + e);
-        return;
+    if (extensionModule.init) {
+        try {
+            extensionState = extensionModule.init(extension);
+        } catch (e) {
+            logExtensionError(uuid, 'Failed to evaluate init function:' + e);
+            return;
+        }
     }
 
     if (!extensionState)